//
//  CategoryCollectionViewCell.m
//  futureLive
//
//  Created by zhoubiwen on 15/11/17.
//  Copyright © 2015年 ZHOU_LI_SUN. All rights reserved.
//

#import "CategoryCollectionViewCell.h"
#import <UIImageView+WebCache.h>
@interface CategoryCollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *c1NameLabel;


@end
@implementation CategoryCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSubViews];
    }
    return self;
}

-(void)setupSubViews{
    
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, self.frame.size.width - 10, 80)];
    self.imageView.backgroundColor = [UIColor yellowColor];
    
    [self.contentView addSubview:self.imageView];
    
    self.c1NameLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, self.frame.size.width - 20, self.frame.size.width - 10, 40)];
    self.c1NameLabel.backgroundColor = [UIColor greenColor];
    
    [self.contentView addSubview:self.c1NameLabel];
}
-(void)setCategoryModel:(CategoryModel *)categoryModel{
    if (_categoryModel != categoryModel) {
        _categoryModel = nil;
        _categoryModel = categoryModel;
        
        
        [self layoutModel];
    }
    
}

-(void)layoutModel{
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:_categoryModel.imageUrl]];
    self.c1NameLabel.text = _categoryModel.c1Name;
    
    
    
}














@end
